package cn.bonoon.kernel.web.models;

import java.util.ArrayList;
import java.util.List;

import cn.bonoon.kernel.support.models.PropertyItem;

public final class JsonPropertyGrid {

	public JsonPropertyGrid() {
		rows = new ArrayList<PropertyItem>();
	}
	
	public void add(String editorid, String groupName, String name, Object editor, String value){
		PropertyItem pi = new PropertyItem();
		pi.setEditorid(editorid);
		pi.setGroup(groupName);
		pi.setName(name);
		pi.setEditor(editor);
		pi.setValue(value == null ? "" : value);
		rows.add(pi);
	}

	private final List<PropertyItem> rows;

	public long getTotal() {
		return rows.size();
	}

	public List<PropertyItem> getRows() {
		return rows;
	}
}
